package com.tuanzi.loan.business.service.family.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuanzi.loan.business.entity.family.ContentActivity;
import com.tuanzi.loan.business.repository.family.ContentActivityRepository;
import com.tuanzi.loan.business.service.family.ContentActivityService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.vo.view.product.LoanProductModelView;

/**
 * @author Ray 2017/09/21
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class ContentActivityServiceImpl extends BaseAuditServiceImpl<ContentActivity, Long> implements ContentActivityService {

	@Autowired
	private ContentActivityRepository contentActivityRepository;

	@Override
	protected JPAAuditRepository<ContentActivity, Long> getRepository() {
		return contentActivityRepository;
	}

	@Override
	public List<LoanProductModelView> loadActivityModelView(Long modelId, Long activityId) {
		return contentActivityRepository.loadActivityModelView(modelId, activityId);
	}

	@Override
	public List<ContentActivity> findAllByMid(Long activityModelId) {
		return contentActivityRepository.findAllByMid(activityModelId);
	}
}
